/**
 * Copyright (C) 2017-2018 pinganfang, Inc. All Rights Reserved.
 */
package com.pingan.haofang.searchcloud.user.constant;

/**
 * 状态 0：正常 1：停用 2:删除
 * 
 * @author huhailiang937
 * @date 2017年5月2日下午7:27:04
 * @since 1.0.0
 */
public enum ProjectStatus {

    NORMAL(0, "normal"), DISABLE(1, "disable"), DELETE(2, "delete");

    private Integer id;
    private String desc;

    private ProjectStatus(Integer id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    public static ProjectStatus get(Number id) {
        if (null == id) {
            return null;
        }
        for (ProjectStatus temp : ProjectStatus.values()) {
            if (temp.getId().equals(id.intValue())) {
                return temp;
            }
        }
        return null;
    }

    public static ProjectStatus getValueByName(String name) {
        if (null == name) {
            return null;
        }
        for (ProjectStatus temp : ProjectStatus.values()) {
            if (temp.getDesc().equals(name)) {
                return temp;
            }
        }
        return null;
    }

    /**
     * @return the id
     */
    public Integer getId() {
        return id;
    }

    /**
     * @param id
     *            the id to set
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * @return the desc
     */
    public String getDesc() {
        return desc;
    }

    /**
     * @param desc
     *            the desc to set
     */
    public void setDesc(String desc) {
        this.desc = desc;
    }
}